// import { reverse } from 'core-js/core/array'
import Vue from 'vue'
import Vuex from '../myvuex'
// import cart from './modules/cart'
// import products from './modules/products'
Vue.use(Vuex)

export default new Vuex.Store({
  strict: process.env.NODE_ENV !== 'production',
  state: {
    count: 0,
    msg: 'Hello Vuex'
  },
  getters: {
    reverseMsg (state) {
      return state.msg.split('').reverse().join('')
    }
  },
  mutations: {
    increate (state, payload) {
      state.count += payload
    }
  },
  actions: {
    increateAsync (contenxt, payload) {
      setTimeout(() => {
        contenxt.commit('increate', payload)
      }, 2000)
    }
  }
  // modules: {
  //   products,
  //   cart
  // }
})
